<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      table {
        border: 1px solid skyblue;
        width: 500px;
        margin: 100px auto;
        border-collapse: collapse;
        /* 设置边框合并 推荐*/
        /* border-spacing: 0; */
        /* 设置边框距离为0 */
      }
      td {
        border: 1px solid skyblue;
        text-align: center;
        vertical-align: middle;
        height: 50px;
      }
      .box1 {
        width: 300px;
        height: 300px;
        background-color: skyblue;
        display: table-cell;
        /* 将元素设置为单元格 */
        /* text-align: center; */
        /* 只对文字有效 */
        vertical-align: middle;
      }
      .box2 {
        width: 200px;
        height: 200px;
        background-color: springgreen;
        margin: 0 auto;
      }
    </style>
  </head>
  <body>
    <div class="box1">
      <div class="box2"></div>
    </div>
    <table>
      <thead>
        <th>日期</th>
        <th>收入</th>
        <th>支出</th>
        <th>合计</th>
      </thead>
      <tbody>
        <tr>
          <td>2001.1.21</td>
          <td>2000</td>
          <td>2500</td>
          <td>-500</td>
        </tr>
        <tr>
          <td>2001.1.21</td>
          <td>2000</td>
          <td>2500</td>
          <td>-500</td>
        </tr>
        <tr>
          <td>2001.1.21</td>
          <td>2000</td>
          <td>2500</td>
          <td>-500</td>
        </tr>
        <tr>
          <td>2001.1.21</td>
          <td>2000</td>
          <td>2500</td>
          <td>-500</td>
        </tr>
      </tbody>
      <tfoot>
        <tr>
          <td colspan="2">小计</td>
          <td colspan="2">-2000</td>
        </tr>
      </tfoot>
    </table>
  </body>
</html>
